const express = require('express');
const expressWs = require('express-ws');

const router = express.Router();
expressWs(router);

router.ws("/user", function (ws, req) {
    ws.send("你连接成功了");
    ws.on("message", function (msg) {
        console.log(msg, "msg");
        ws.send("这是第二次发送信息");
    });
});

module.exports = router;